package chapter;

public class toString {
    public static void main(String[] args) {
        Object o = new Person5();
        String s = o.toString();
        //toString是默认打印对象的内存地址，为了方便观察可以进行重写
        //hashCode也是获取地址的
        //getClass获取对象的类型信息
        System.out.println(s);
        int i = o.hashCode();
        o.getClass().getName();
        System.out.println(i);
        System.out.println(o.equals(new Person()));
    }
}
class Person5 {
    public String name = "zyh";

    @Override
    public boolean equals(Object obj) {
        return true;
    }
//    @Override
//    public String toString() {
//        return "Person[" + name + "]";
//    }
}
